<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>一号轴承网</title>
    <meta name="keywords" content="" />
    <link rel="shortcut icon" href="/img/logo.ico" type="image/x-icon">
    <meta name="description" content="电子交易平台" />
    <link href="css/bootstrap.min.css?v=3.3.6"
          th:href="@{/css/bootstrap.min.css?v=3.3.6}" rel="stylesheet">
    <script src="/js/jquery.min.js" type="text/javascript"></script>
    <link href="/css/front/style.css" rel="stylesheet" type="text/css" />

    <style>
        .box_con ul:nth-child(odd){ background:#fff; }
        .box_con ul:nth-child(even){ background:#eee;}
        h2{margin-top: 5px}
    </style>
</head>
<body style="zoom: 1;">
<div class="top">
    <div class="top_m b-r-s">
        <div class="top_l">
            <span>欢迎来到“<a href="/front/index">一号轴承网”</a></span>
            <span th:if="${!isLogin}">
                <a style="font-size: 15px;color: #ff7300;font-weight:bold;" rel="nofollow" href="/login">登录</a>
                <a style="font-size: 15px;color: #ff7300;font-weight:bold;" rel="nofollow" href="/front/register">免费注册</a>
            </span>
            <span th:if="${isLogin}">
                <a style="font-size: 15px;color: #ff7300;font-weight:bold;" rel="nofollow" href="/member/welcome">会员中心</a>
            </span>
        </div>
    </div>
    <span style="float: right;padding-right: 30px;" th:if="${isLogin}">
        <a  style="font-size: 15px;color: #ff7300;font-weight:bold;" rel="nofollow" href="/logout">退出</a>
    </span>
</div>
<div class="header">
    <div class="header_t">
        <div class="logo">
            <span th:if="${memberType==1}">
                <img src="/img/logo_buyer.jpg"  alt="一号轴承网" width="191" height="58" />
            </span>
            <span th:if="${memberType==2}">
                <img src="/img/logo_seller.jpg"  alt="一号轴承网" width="191" height="58" />
            </span>
            <span th:if="${memberType==3}">
                <img src="/img/logo_both.jpg"  alt="一号轴承网" width="191" height="58" />
            </span>
            <span style="font-size: 20px" th:text="${owner.company}"></span>
        </div>
        <form  action="/front/product/tosearch" method="get" onsubmit="return checkModel()">
            <input type="hidden" id="hid" value="1">
            <div class="search">
                <div class="search_input">
                    <div id="s_border">
                        <input name="userId" type="hidden" th:value="${owner.id}">
                        <input type="text" id="model" placeholder="请输入型号" class="search_txt" name="model" value="" style="width: 100%;">
                    </div>
                    <input type="submit" class="search_btn" value="">
                </div>
            </div>
        </form>
    </div>
</div>
<script>
    function checkModel(){
        var ttt = $("#model").val();
        if (ttt==null || ttt.length<3){
            alert("型号不能为空或者少于三位")
            return false;
        }
        return true;
    }
</script>
<div class="content">
    <div class="box_f">
        <div class="box">
            <h2 class="box_tit"></a><span class="cgtit">公司信息</span></h2>
            <div class="box_con">
                <div id="left_content"><!-- 除首页外其他页样式为left_content -->
                    <!--公司档案begin-->
                    <div id="company_doc" class="mod_bg">
                        <h2 class="index_title">基础档案</h2>
                        <h4 id="member-name" th:text="${owner.company}"></h4>
                        <p class="cdc-p">
                            <span class="cdoc_attr">会员类型：</span>
                            <span th:text="${owner.memberLevel==1?'普通会员':owner.memberLevel==2?'高级会员':owner.memberLevel==3?'vip会员':'非会员'}"></span>
                        </p>
                        <p class="cdc-p">
                            <span class="cdoc_contact">联系人：</span>
                            <span class="cdoc_contacter" th:text="${owner.userName}"> </span>
                        </p>
                        <p class="cdc-p">
                            <span class="cdoc_contact">电话：</span>
                            <span class="cdoc_contacter" th:text="${owner.districtCode}"> </span>
                            <span class="cdoc_contacter" th:text="${owner.telephone}"> </span>
                        </p>
                        <p class="cdc-p">
                            <span class="cdoc_contact">传真：</span>
                            <span class="cdoc_contacter" th:text="${owner.telephone}"> </span>
                        </p>
                        <p class="cdc-p">
                            <span class="cdoc_contact">手机：</span>
                            <span class="cdoc_contacter" th:text="${owner.mobile}"></span>
                        </p>
                        <p class="cdc-p">
                            <span class="cdoc_contact">地址：</span>
                            <span class="cdoc_contacter" th:text="${owner.address}"></span>
                        </p>
                        <p class="cdc-p">
                            <span class="cdoc_contact">邮箱：</span>
                            <span class="cdoc_contacter" th:text="${owner.email}"> </span>
                        </p>
                        <p class="cdc-p">
                            <span class="cdoc_contact">qq：</span>
                            <span class="cdoc_contacter" th:text="${owner.qq}"></span>
                        </p>
                    </div>
                    <!--公司档案end-->
                </div>
                <div id="right_content">
                    <div id="profile_content">
                        <div id="company_about">
                            <h2 id="profile_title1">公司简介</h2>
                            <p th:text="${owner.companyDesc}"></p>
                        </div>

                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="box_f">
            <!--展会-->
        <div class="box">
            <h2 class="box_tit"><a title="采购信息" href="#" hidden="hidden">更多&gt;</a><span class="cgtit">采购信息</span></h2>
            <div class="box_con">
                <ul class="cg_tit"  style="background-color: #fff198">
                    <li style="margin-left: 5px;">型号</li>
                    <li>品牌</li>
                    <li>类型</li>
                    <li>数量</li>
                    <li>时间</li>
                </ul>
                <ul class="cg_list" th:each="demand,iterStat:${commonList}">
                    <li style="margin-left: 5px;"  th:text="${demand.model==null?'&nbsp;':demand.model}"></li>
                    <li th:text="${demand.brand==null?'&nbsp;':demand.brand}"></li>
                    <li th:text="${demand.type==null?'&nbsp;':demand.type}"></li>
                    <li th:text="${demand.number==null?'&nbsp;':demand.number}"></li>
                    <li th:text="${demand.createTime==null?'':#dates.format(demand.createTime,'yyyy-MM-dd')}"></li>
                </ul>
            </div>
        </div>
    </div>
    <div class="box_f">
            <!--展会-->
        <div class="box">
            <h2 class="box_tit"><a title="采购信息" href="#" hidden="hidden">更多&gt;</a><span class="cgtit">热卖产品</span></h2>
            <div class="box_con">
                <ul class="cg_tit7" style="background-color: #ffffa4">
                    <li style="width: 25%;margin-left: 5px;">公司</li>
                    <li style="width: 10%;">型号</li>
                    <li style="width: 10%;">品牌</li>
                    <li style="width: 10%;">类型</li>
                    <li style="width: 5%;">数量</li>
                    <li style="width: 5%;">单价</li>
                    <li style="width: 15%;">时间</li>
                    <li style="width: 15%;">备注</li>
                </ul>
                <ul class="cg_list7" th:each="product,iterStat:${hotsellList}">
                    <li  style="width: 25%;margin-left: 5px;" th:text="${product.company==null?'&nbsp':product.company}"></li>
                    <li style="width: 10%;" th:text="${product.model==null?'&nbsp':product.model}"></li>
                    <li style="width: 10%;" th:text="${product.brand==null?'&nbsp':product.brand}"></li>
                    <li style="width: 10%;" th:text="${product.type==null?'&nbsp':product.type}"></li>
                    <li style="width: 5%;" th:text="${product.number==null?'&nbsp':product.number}"></li>
                    <li style="width: 5%;" th:text="${product.unitPrice==null?'&nbsp':product.unitPrice}"></li>
                    <li style="width: 15%;" th:text="${product.uploadTime==null?'':#dates.format(product.uploadTime,'yyyy-MM-dd')}"></li>
                    <li style="width: 15%;" th:text="${product.note==null?'&nbsp':product.note}"></li>

                </ul>
            </div>
        </div>
    </div>
    <div class="box_f">
        <div class="box">
            <h2 class="box_tit"><span class="cgtit">最新库存</span></h2>
            <div class="box_con">
                <ul class="cg_tit7" style="background-color: #ffffa4">
                    <li style="width: 25%;margin-left: 5px;">公司</li>
                    <li style="width: 10%;">型号</li>
                    <li style="width: 10%;">品牌</li>
                    <li style="width: 10%;">类型</li>
                    <li style="width: 5%;">数量</li>
                    <li style="width: 5%;">单价</li>
                    <li style="width: 15%;">时间</li>
                    <li style="width: 15%;">备注</li>
                </ul>
                <ul class="cg_list7" th:each="product,iterStat:${productList}">
                    <li  style="width: 25%;margin-left: 5px;" th:text="${product.company==null?'&nbsp':product.company}"></li>
                    <li style="width: 10%;" th:text="${product.model==null?'&nbsp':product.model}"></li>
                    <li style="width: 10%;" th:text="${product.brand==null?'&nbsp':product.brand}"></li>
                    <li style="width: 10%;" th:text="${product.type==null?'&nbsp':product.type}"></li>
                    <li style="width: 5%;" th:text="${product.number==null?'&nbsp':product.number}"></li>
                    <li style="width: 5%;" th:text="${product.unitPrice==null?'&nbsp':product.unitPrice}"></li>
                    <li style="width: 15%;" th:text="${product.uploadTime==null?'':#dates.format(product.uploadTime,'yyyy-MM-dd')}"></li>
                    <li style="width: 15%;" th:text="${product.note==null?'&nbsp':product.note}"></li>

                </ul>
            </div>
        </div>
    </div>
    <div th:replace="include::foot1">
    </div>
    <div th:replace="include::foot2">
    </div>
    <script src="/js/appjs/front/index.js" type="text/javascript"></script>
</div>
<script language="javascript" type="text/javascript">
    function check1(username){

        if(username == null || username == ""){
            $("#tp1").text("用户名不能为空");
            $("#tp1").css("color","red");
            $("#username").focus;
            return false ;
        }else {
            $("#tp1").text("");
        }
        return true;
    }
    function check2(password){

        if(password == null || password == ""){
            $("#tp2").text("密码不能为空");
            $("#tp2").css("color","red");
            $("#password").focus;
            return false;
        }else {
            $("#tp2").text("");
        }
        return true;
    }
    function login(){
        var username = $("input[name='username']").val();
        var password = $("input[name='password']").val();
        if(check1(username)&&check2(password)){
            $.ajax({
                url:"/login",
                type:"post",
                data:{username:username,password:password},
                dataType:"json",
                success:function (data) {
                    console.log(data);
                    if (data.code==0){
                        location.reload();
                    }else {
                        alert(data.msg);
                    }
                }
            })
        }
    }

    $(document).keydown(function (event) {
        if (event.keyCode == 13) {
            $("#denglu").click();
        }
    });
</script>
</body>
</html>